#!/bin/sh
str=${CONFIG_FILES}
for i in `echo "$str" | sed 's/;/\n/g'`
do
   appid=${i%%>*}
   appid=${appid##*@}
   token=${i%%@*}
   path=${i##*>}
   for j in `echo "$path" | sed 's/,/\n/g'`
   do
    echo 'curl-->appid:'${appid}' token:'${token}' path:'${j};
    echo 'window.RPConfig = '`curl -L --request GET \
    --url http://${APOLLO}/openapi/v1/envs/${ENV}/apps/${appid}/clusters/default/namespaces/application \
    --header 'Authorization:'${token} \
    --header 'Cache-Control: no-cache' \
    --header 'Content-Type: application/json'` >${j}
   done
done;
exec nginx -g 'daemon off;'